import request from '@/utils/request'
import { shallowMount } from '@vue/test-utils'


/**
 * 下载员工导入模版
 * **/

export function getExportTemplate() {
  return request({
    url: '/sys/user/import/template',
    responseType: 'blob' // 二进制文件流
  })
}

export function exportExcel(data) {
  return request({
    url: '/exp/excel',
    responseType: 'blob', // 二进制文件流
    method: 'post',
    data
  })
}

/**
 * 上传用户的excel
 *
*/
export function uploadExcel(data) {
  return request({
    url: '/secondment/upload/excel',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}

export function uploadPdf(data) {
  return request({
    url: '/secondment/upload/pdf',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}

export function uploadConfirmPdf(data) {
  return request({
    url: '/secondment/con/pdf',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}
export function updateName(data) {
  return request({
    url: `/secondment/secondmentName`,
    method: 'post',
    data
  })
}
export function singleConfirmSecondment(data) {
  return request({
    url: '/secondment/single/pdf',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}
export function allDepartmentConfirmSecondment(data) {
  return request({
    url: '/secondment/alldepart/pdf',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}

export function oneDepartmentConfirmSecondment(data) {
  return request({
    url: '/secondment/onedepart/pdf',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}
export function listHead(id) {
  return request({
    url: `/information/head/${id}`
  })
}

export function listSecondmentInformation(data) {
  return request({
    url: '/information/body',
    method: 'post',
    data
  })
}

export function deleteSecondmentInformation(id) {
  return request({
    url: `/information/delete/${id}`,
  })
}

export function getExcelNames(id) {
  return request({
    url: `/information/names/${id}`,
  })
}

export function distributeCase(data) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: '/secondment/distribute',
    method: 'post',
    data
  })
}

export function checkNumOfSecondments(data) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: '/secondment/check',
    method: 'post',
    data
  })
}
export function changeState(data) {
  return request({
    url: '/information/change/state',
    method: 'post',
    data
  })
}

export function changeTip(data) {
  return request({
    url: '/information/change/tips',
    method: 'post',
    data
  })
}

export function uploadResponseFile(data) {
  return request({
    url: '/user/response/file',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}

export function uploadTempFile(data) {
  return request({
    url: '/user/temp/file',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}

export function downloadSecondmentFile(id) {
  return request({
    url: `/user/download/${id}`,
    responseType: 'blob'
  })
}

export function downloadConfirm(id) {
  return request({
    url: `/user/confirm/${id}`,
    responseType: 'blob'
  })
}

export function downloadforDepartmentConfirm(secondmentId,departmentId) {
  return request({
    url: "/user/confirm/department?secondmentId=" +secondmentId + "&departmentId=" + departmentId,
    method: 'get',
    responseType: 'blob'
  })
}

export function getConfirmNameforDepartment(secondmentId,departmentId) {
  return request({
    url: "/user/confirmname/department?secondmentId=" +secondmentId + "&departmentId=" + departmentId,
    method: 'get',
  })
}

export function changeResponseState(data) {
  return request({
    url: '/response/change/state',
    method: 'post',
    data
  })
}

export function getResponseState(data) {
  return request({
    url: '/response/get/state',
    method: 'post',
    data
  })
}

export function getPdfName(id) {
  return request({
    url: `/secondment/pdf/name/${id}`,
  })
}
export function getResponsePdfName(data) {
  return request({
    url: `/response/pdf/name`,
    method: 'post',
    data
  })
}
export function getConfirmName(id) {
  return request({
    url: `/secondment/confirm/name/${id}`,
  })
}

export function getSelection(data) {
  return request({
    url: '/selection/list',
    method: 'post',
    data
  })
}

export function addSelection(data) {
  return request({
    url: '/selection/add',
    method: 'post',
    data
  })
}

export function getTemplateList() {
  return request({
    url: '/template/list',
  })
}

export function addTemplate(data) {
  return request({
    url: '/template/add',
    method: 'post',
    data
  })
}

export function uploadTemplate(data) {
  return request({
    url: '/template/upload',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}


export function downTemplate(id) {
  return request({
    url: `/template/download/${id}`,
    responseType: 'blob'
  })
}

export function getFileName(id) {
  return request({
    url: `/template/name/${id}`,
  })
}

export function delTemplate(id) {
  return request({
    url: `/template/del/${id}`,
  })
}

export function getTemplateNames() {
  return request({
    url: '/template/names',
  })
}

export function addSelectionTemplate(data) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: '/template/addT',
    method: 'post',
    data
  })
}

export function getTemplateL(id) {
  return request({
    url: `/template/get/${id}`,
  })
}

export function uploadSelectionPdf(data) {
  return request({
    url: '/selection/pdf',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}


export function getSelectionResponse(id) {
  return request({
    url: `/rep/list/${id}`,
  })
}


export function getSelectionResponseFileName(id) {
  return request({
    url: `/rep/name/${id}`
  })
}

export function getSelectionResponseFile(id) {
  return request({
    url: `/rep/file/${id}`,
    responseType: 'blob'
  })
}

export function delTemp(id) {
  return request({
    url: `/template/dis/del/${id}`,
  })
}

export function uploadZip(data) {
  return request({
    url: '/rep/response',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}

export function uploadToLevelOne(data) {
  return request({
    url: '/secondment/upload/to',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}

export function deleteSecondment(id) {
  return request({
    url: `/secondment/delete/${id}`,
  })
}

export function aggreAll(data) {
  return request({
    url: '/user/check',
    method: 'post',
    data
  })
}

export function searchUser(data) {
  return request({
    url: '/secondment/search',
    method: 'post',
    data
  })
}

export function confirmSecondment(id) {
  return request({
    url: `/secondment/confirm/${id}`,
  })
}

export function getC(data) {
  return request({
    url: '/secondment/getC',
    method: 'post',
    data
  })
}

export function cancelConfirm(id) {
  return request({
    url: `/information/cancel/${id}`,
  })
}
